<script setup>
import { ref, getCurrentInstance } from "vue";
import { useRouter } from "vue-router";
import { getLocalStorage } from "@/utils/common";

const { proxy } = getCurrentInstance();

const route = useRouter();

const list = ref([]);

window.sessionStorage.removeItem("activeRoute");
window.sessionStorage.removeItem("pmActiveRoute");
window.sessionStorage.removeItem("ibeActiveRoute");
window.sessionStorage.removeItem("pcActiveRoute");
window.sessionStorage.removeItem("bimActiveRoute");

if (getLocalStorage("userInfo")) {
  list.value = getLocalStorage("userInfo").siteList;
} else {
  route.push("/login");
}

const itemClickHandle = function (item) {
  route.push({
    name: "project",
    params: {
      proName: item.unionId,
    },
  });
};

</script>

<template>
  <div class="container">
    <div class="logo"></div>
    <div class="desc">{{ proxy._GLOBAL.SYSTITLE }}</div>
    <div class="con-box">
      <div class="con-scorll">
        <div
          class="con-item"
          v-for="(item, index) in list"
          :key="index"
          @click="itemClickHandle(item)"
        >
          <span>{{ item.projectName }}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.container {
  width: 100vw;
  height: 100vh;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-image: url("@/assets/images/login/bg.png");
  padding: 20px;
  box-sizing: border-box;

  .logo {
    width: 120px;
    height: 40px;
    margin-left: 20px;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    background-image: url("@/assets/images/home/logo2.png");
  }

  .desc {
    font-size: 50px;
    font-family: HanYiLingXinTiJian;
    letter-spacing: 6px;
    color: #6498d3;
    text-align: center;
    padding-top: 100px;
  }

  .con-box {
    width: 330px;
    height: 410px;
    margin: 50px auto;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    background-image: url("@/assets/images/home/bg.png");

    .con-scorll {
      width: 95%;
      padding: 0px 10px;
      box-sizing: border-box;
      height: 400px;
      margin: 10px auto;
      overflow-y: auto;
      overflow-x: hidden;

      .con-item {
        width: 100%;
        height: 60px;
        line-height: 60px;
        color: #3d5c99;
        font-size: 16px;
        background-repeat: no-repeat;
        background-size: 100% 100%;
        background-image: url("@/assets/images/home/item.png");
        margin-top: 10px;
        cursor: pointer;

        span {
          display: inline-block;
          width: 75%;
          text-indent: 20px;
          font-weight: bold;
          overflow: hidden;
          white-space: nowrap;
          text-overflow: ellipsis;
        }
      }
    }

    .con-scorll::-webkit-scrollbar {
      /*滚动条整体样式*/
      width: 5px;
      /*高宽分别对应横竖滚动条的尺寸*/
      height: 1px;
    }

    .con-scorll::-webkit-scrollbar-thumb {
      /*滚动条里面小方块*/
      border-radius: 10px;
      -webkit-box-shadow: inset 0 0 5px #adbbd7;
      background: #adbbd7;
    }
  }
}
</style>
